package com.tool.views;

import java.io.Serializable;

import org.apache.commons.lang3.StringUtils;

import com.google.common.base.CaseFormat;
import com.tool.enums.TypeEnum;

public class Column implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private String name;

	private String jdbcType;

	private String javaType;

	private String description;

	private boolean ingore;

	private boolean autoConstructor;

	private String regular;

	private String humpName;

	private String val;

	public String getHumpName() {
		humpName = "";
		if (StringUtils.isNotBlank(name)) {
			humpName = CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, name);
		}
		return humpName;
	}

	public boolean isAutoConstructor() {
		return autoConstructor;
	}

	public void setAutoConstructor(boolean autoConstructor) {
		this.autoConstructor = autoConstructor;
	}

	public boolean isIngore() {
		return ingore;
	}

	public void setIngore(boolean ingore) {
		this.ingore = ingore;
	}

	public String getRegular() {
		return regular;
	}

	public void setRegular(String regular) {
		this.regular = regular;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getVal() {
		return val;
	}

	public void setVal(String val) {
		this.val = val;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getJavaType() {
		javaType = "";
		if (StringUtils.isBlank(getJdbcType())) {
			return javaType;
		}

		TypeEnum typeEnum = TypeEnum.findByJdbcType(jdbcType);
		if (null != typeEnum) {
			javaType = typeEnum.getJavaType();
		}
		return javaType;
	}

	public void setJavaType(String javaType) {
		this.javaType = javaType;
	}

	public String getJdbcType() {
		return jdbcType;
	}

	public void setJdbcType(String jdbcType) {
		this.jdbcType = jdbcType;
	}
}
